package statistics;

import junit.framework.TestCase;
import numerics.Pair;
import numerics.Sums;

public class testSums extends TestCase {
	public void testarraySum() {
		double [] ys = {1.0, 2.0, 3.0, 4.0};
		new Sums();
		assertEquals(10.0, Sums.arraySum(ys), 0.5E-5);
	}

	public void testsquaredSum() {
		double [] ys = {1.0, 2.0, 3.0, 4.0};
		new Sums();
		assertEquals(30.0, Sums.squaredSum(ys), 0.5E-5);	
	}
	
	public void testpairSum() {
		Pair [] pairs = new Pair[3];
		pairs[0] = new Pair(10.0, 20.0);
		pairs[1] = new Pair(10.0, 20.0);
		pairs[2] = new Pair(10.0, 20.0);
		new Sums();
		assertEquals(600.0, Sums.pairSum(pairs), 0.5E-5);
	}
}
